
package com.qdu.servlet;

import com.qdu.service.AdminService;
import com.qdu.service.impl.AdminServiceImpl;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author 24959
 */
@WebServlet("/da")
public class DeleteAdminServlet extends HttpServlet{
    AdminService as=new AdminServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        //1. 获取请求参数
        //获取要删除的管理员的编号
        int Ano = Integer.parseInt(req.getParameter("Ano"));
        //2. 执行业务逻辑
        //根据编号从数据库删除管理员
        int rows =as.deleteAdmin(Ano);
         
        resp.getWriter().println(rows);
    }

    
    
}
